package puziran.sofa.http.client;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class HttpPropertyUtil {
	private static String propertyFileName;
	private static ResourceBundle resourceBundle;
	private static HttpPropertyUtil pu = new HttpPropertyUtil("config/serviceHost");

	public HttpPropertyUtil(String propertyFileName) {
		resourceBundle = ResourceBundle.getBundle(propertyFileName);
	}

	public static HttpPropertyUtil getInstance() {
		return pu;
	}

	public static String getValue(String key) {
		if ((key == null) || (key.equals("")) || (key.equals("null"))) {
			return "";
		}
		String result = "";
		try {
			result = resourceBundle.getString(key);
		} catch (MissingResourceException e) {
			e.printStackTrace();
		}
		return result;
	}

	public static void main(String[] args) {
		HttpPropertyUtil pu = new HttpPropertyUtil("src/main/java/ip");
		String a = getValue("a");
		System.out.println(a);
	}
}